package com.myblog.controller;

import com.myblog.service.SiteInfoService;
import com.myblog.utils.DataMap;
import com.myblog.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class SiteInfoController {
    @Autowired
    private SiteInfoService siteService;

    /**
     * 获取网站信息
     * @return
     */
    @GetMapping("/getSiteInfo")
    public String getSiteInfo(){
        try {
            DataMap data = siteService.getSiteInfo();
            return JsonResult.build(data).toJSON();
        } catch (Exception e) {
            log.error("SiteInfoController getSiteInfo Exception",e);
        }
        return JsonResult.fail().toJSON();
    }
}
